﻿/*
 * Copyright 2002-2010 Edward L. Stauff.                  Contact: <EdStauff@gmail.com>.
 * 
 * This file, "DebugWriter.cs", is part of the "Stauffware.Common.IO" class library.
 * "Stauffware.Common" is free software: you can redistribute it and/or 
 * modify it under the terms of the GNU Lesser Public License as published by the 
 * Free Software Foundation, either version 3 of the License, or (at your option) 
 * any later version.
 * 
 * "Stauffware.Common.IO" is distributed in the hope that it will be useful, 
 * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 
 * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser Public License for more 
 * details.
 * 
 * You should have received a copy of the GNU Lesser Public License along with 
 * the "Stauffware.Common" sources.  If not, see <http://www.gnu.org/licenses/>.
 */
using System;
using System.Collections.Generic;
using System.IO;
using System.Text;
using System.Diagnostics;
using Stauffware.Common.Core;

namespace Stauffware.Common.IO
{
	/// <summary>
	/// A TextWriter that writes to System.Diagnostics.Debug.Write.
	/// </summary>
	public class DebugWriter : TextWriter
	{
		/// <see cref="System.IO.TextWriter.Write(char)"/>
        public override void Write(char value) { Debug.Write("" + value); }

		/// <see cref="System.IO.TextWriter.Write(string)"/>
		public override void Write (string value) { Debug.Write(value); }

		/// <see cref="System.IO.TextWriter.Write(char[], int, int)"/>
		public override void Write (char[] buffer, int index, int count)
        { Debug.Write(new string(buffer, index, count)); }

		/// <see cref="System.IO.TextWriter.WriteLine(string)"/>
		public override void WriteLine (string s) { Debug.WriteLine(s); }

		/// <see cref="System.IO.TextWriter.Encoding"/>
		public override Encoding Encoding
		{
			get { throw new NotImplementedException(); }
		}
	}
}
